#! /usr/bin/env python3
# -*- coding: UTF-8 -*-

import sqlite3


class litedb:

    def __new__(cls, *arg, **kw):
        instance = super().__new__(cls)
        return instance

    def open(self, name):
        self.name = name
        self.con = sqlite3.connect(name)
        self.cur = self.con.cursor()

    def close(self):
        self.con.close()

    def save(self):
        self.con.commit()

    def sql(self, sql):
        return self.cur.execute(sql)

    def ssql(self, sql):
        res = self.cur.execute(sql)
        self.con.commit()
        return res

    def debug(func, **kw):
        pass


if __name__ == "__main__":
    db = litedb()
    db.open("test.db")
    print(db.name)

    db2 = litedb()

    print(db._instance)
    print(db2._instance)

    print(db.name)
    print(db2.name)
